<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>XA: Frequently Asked Questions</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
    <link rel="up" href="xa.html" title="Chapter 15.  Distributed Transactions" />
    <link rel="prev" href="xa_xa_restrict.html" title="Restrictions on XA Transactions" />
    <link rel="next" href="apprec.html" title="Chapter 16.  Application Specific Logging and Recovery" />
  </head>
  <body>
    <div xmlns="" class="navheader">
      <div class="libver">
        <p>Library Version 12.1.6.2</p>
      </div>
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">XA: Frequently Asked Questions</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="xa_xa_restrict.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 15.  Distributed Transactions </th>
          <td width="20%" align="right"> <a accesskey="n" href="apprec.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="xa_faq"></a>XA: Frequently Asked Questions</h2>
          </div>
        </div>
      </div>
      <div class="orderedlist">
        <ol type="1">
          <li>
            <span class="bold">
              <strong>Is it possible to mix XA and non-XA
                transactions?</strong>
            </span>
            <p>
                Yes. It is also possible for XA and non-XA
                transactions to coexist in the same Berkeley DB
                environment. To do this, specify the same environment
                to the non-XA <a href="../api_reference/C/envopen.html" class="olink">DB_ENV-&gt;open()</a> calls as was specified in the
                Tuxedo configuration file.
            </p>
          </li>
          <li>
            <span class="bold">
              <strong>Does converting an application to
                run within XA change any of the already existing C/C++
                API calls it does?</strong>
            </span>
            <p>
                When converting an application to run under XA, the
                application's Berkeley DB calls are unchanged, with
                three exceptions:
            </p>
            <div class="orderedlist">
              <ol type="a">
                <li>
                    The application must specify the
                    <a href="../api_reference/C/dbcreate.html#dbcreate_DB_XA_CREATE" class="olink">DB_XA_CREATE</a> flag to the <a href="../api_reference/C/dbcreate.html" class="olink">db_create()</a>
                    function.
                </li>
                <li>
                    Unless the application is performing an
                    operation for a non-XA transaction, the
                    application should never explicitly call
                    <a href="../api_reference/C/txncommit.html" class="olink">DB_TXN-&gt;commit()</a>, <a href="../api_reference/C/txnabort.html" class="olink">DB_TXN-&gt;abort()</a>, and <a href="../api_reference/C/txnbegin.html" class="olink">DB_ENV-&gt;txn_begin()</a>, and those
                    calls should be replaced by calls into the Tuxedo
                    transaction manager.
                </li>
                <li>
                    Unless the application is performing an
                    operation for a non-XA transaction, the
                    application should specify a transaction argument
                    of NULL to Berkeley DB methods taking transaction
                    arguments (for example, <a href="../api_reference/C/dbput.html" class="olink">DB-&gt;put()</a> or
                    <a href="../api_reference/C/dbcursor.html" class="olink">DB-&gt;cursor()</a>).
                </li>
              </ol>
            </div>
            <p>
                Otherwise, the application should be
                unchanged.
            </p>
          </li>
          <li>
            <span class="bold">
              <strong>How does Berkeley DB recovery
                interact with recovery by the Tuxedo transaction
                manager?</strong>
            </span>
            <p>
                Recovery is completed in two steps. First, each
                resource manager should recover its environment(s).
                This can be done via a program that calls <a href="../api_reference/C/envopen.html" class="olink">DB_ENV-&gt;open()</a> or
                by calling the <a href="../api_reference/C/db_recover.html" class="olink">db_recover</a> utility. If using the
                <a href="../api_reference/C/db_recover.html" class="olink">db_recover</a> utility, then the 
                teoption should be specified so that
                the regions that are recovered persist after the
                utility exits. Any transactions that were prepared,
                but neither completed nor aborted, are restored to
                their prepared state so that they may be aborted or
                committed via the Tuxedo recovery mechanisms. After
                each resource manager has recovered, then Tuxedo
                recovery may begin. Tuxedo will interact with each
                resource manager via the __db_xa_recover function
                which returns the list of prepared, but not yet
                completed transactions. It should issue a commit or
                abort for each one, and only after having completed
                each transaction will normal processing resume.
            </p>
            <p>
                Finally, standard log file archival and catastrophic
                recovery procedures should occur independently of XA
                operation.
            </p>
          </li>
          <li>
            <span class="bold">
              <strong>Does Berkeley DB provide
                multi-threaded support for XA transactions?</strong>
            </span>
            <p> 
                Yes. For information on how to build multi-threaded
                servers for XA transactions, see <a class="ulink" href="http://download.oracle.com/docs/cd/E13161_01/tuxedo/docs10gr3/pgc/pgthr.html" target="_top">http://download.oracle.com/docs/cd/E13161_01/tuxedo/docs10gr3/pgc/pgthr.html</a>. 
                All databases used by servers should be opened
                with handles created with the <a href="../api_reference/C/dbcreate.html#dbcreate_DB_XA_CREATE" class="olink">DB_XA_CREATE</a> flag in
                the <a href="../api_reference/C/dbcreate.html" class="olink">db_create()</a> method and must be opened in the
                tpsvrinit routine. Note that the environment parameter
                of the <a href="../api_reference/C/dbcreate.html" class="olink">db_create()</a> method must be assigned NULL. For
                more information on the tpsvrinit routine, see <a class="ulink" href="http://download.oracle.com/docs/cd/E13161_01/tuxedo/docs10gr3/pgc/pgthr.html" target="_top">http://download.oracle.com/docs/cd/E13161_01/tuxedo/docs10gr3/pgc/pgthr.html</a>.
            </p>
          </li>
        </ol>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="xa_xa_restrict.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="xa.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="apprec.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Restrictions on XA Transactions </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Chapter 16.  Application Specific Logging and
        Recovery </td>
        </tr>
      </table>
    </div>
  </body>
</html>
